home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 May / Chip Mayıs 2001.iso / prog / share / 30 / setup.exe / data1.cab / Fsi_-_English / CheckUpdate / CheckUpdate.js < prev   
Encoding:
Text File  |  2001-03-15  |  3.4 KB  |  111 lines

  1. function checkForUpdate(title)
  2. {
  3.     app = new ActiveXObject('FSI.FSIApplication');
  4.     app.OpenStatusDialog(title, '\nConnecting...');
  5.     version = app.GetRegistryString(true, 'Version');
  6.     version = version.split('.')[0];
  7.     versionInfo = app.GetRegistryString(true, 'VersionInfo');
  8.  
  9.     var s = app.HttpRequest('http://www.netobjects.com/update/AutoUpdater.cgi', '', 'Application=Fusion&Version=' + version + '&VersionInfo=' + versionInfo, false, false, true);
  10.     
  11.     app.CloseStatusDialog(0);
  12.  
  13.     if (s.length == 0)
  14.         return false;
  15.  
  16.     register(app);    // We are online, check whether there is a need to register.
  17.  
  18.     args = s.split(',');
  19.     if (args.length < 2)
  20.         return false;
  21.  
  22.     app.LatestFusionUpdate = args[0];
  23.     app.LatestUpdater = args[1];
  24.  
  25.     if (args.length >= 4)
  26.     {
  27.         serviceUpdate = args[2] - 0;
  28.         hostingUpdate = args[3] - 0;
  29.         if (serviceUpdate > app.ServiceUpdate)
  30.             app.ServiceUpdate = serviceUpdate;
  31.         if (hostingUpdate > app.HostingUpdate)
  32.             app.HostingUpdate = hostingUpdate;
  33.     }
  34.  
  35.     if (args.length >= 6)
  36.     {
  37.         serviceViewUpdate = args[4] - 0;
  38.         newsUpdate = args[5] - 0;
  39.         if (serviceViewUpdate > app.ServiceViewUpdate)
  40.             app.ServiceViewUpdate = serviceViewUpdate;
  41.         if (newsUpdate > app.NewsUpdate)
  42.             app.NewsUpdate = newsUpdate;
  43.     }
  44.  
  45.     return true;
  46. }
  47.  
  48. function checkOnline(title)
  49. {
  50.     for (;;)
  51.     {
  52.         if (checkForUpdate(title))
  53.             return true;
  54.  
  55.         if (window.showModalDialog("../InitFusion/Offline.html", 0,
  56.                 "status:no;help:no;border:thin;dialogWidth:220px;dialogHeight:110px;center:yes;scroll:no;") != 1)
  57.             return false;
  58.     }
  59. }
  60.  
  61. function register(app)
  62. {
  63.     serialNumber = app.GetRegistryString(true, 'SerialNumber');
  64.     if (!serialNumber.length)
  65.         return;
  66.  
  67.     updated = app.GetSystemVar('nof_up_updated');
  68.     email = app.GetSystemVar('nof_up_email');
  69.  
  70.     if ((updated == 'true' || updated == 'True') && email && email.length)
  71.     {
  72.         netoInfo = (app.GetSystemVar('nof_up_netoinfo') == 'True') ? 'Yes' : 'No';
  73.         partnerInfo = (app.GetSystemVar('nof_up_partnerinfo') == 'True') ? 'Yes' : 'No';
  74.         id = app.GetSystemVar('nof_up_id');
  75.  
  76.         if (!id || !id.length)
  77.             id = email;
  78.  
  79.         args = 'id=' + id;
  80.         args += '&newid=' + email;
  81.         args += '&serialnumber=' + app.GetRegistryString(true, 'SerialNumber');
  82.         args += '&versioninfo=' + app.GetRegistryString(true, 'VersionInfo');
  83.         args += '&firstname=' + app.GetSystemVar('nof_up_firstname');
  84.         args += '&lastname=' + app.GetSystemVar('nof_up_lastname');
  85.         args += '&email=' + app.GetSystemVar('nof_up_email');
  86.         args += '&companyname=' + app.GetSystemVar('nof_up_companyname');
  87.         args += '&address1=' + app.GetSystemVar('nof_up_address1');
  88.         args += '&address2=' + app.GetSystemVar('nof_up_address2');
  89.         args += '&city=' + app.GetSystemVar('nof_up_city');
  90.         args += '&state=' + app.GetSystemVar('nof_up_state');
  91.         args += '&zip=' + app.GetSystemVar('nof_up_zip');
  92.         args += '&country=' + app.GetSystemVar('nof_up_country');
  93.         args += '&phone=' + app.GetSystemVar('nof_up_phone');
  94.         args += '&fax=' + app.GetSystemVar('nof_up_fax');
  95.         args += '&website=' + app.GetSystemVar('nof_up_url');
  96.         args += '&netoinfo=' + netoInfo;
  97.         args += '&partnerinfo=' + partnerInfo;
  98.     
  99.         var s = app.HttpRequest('http://webdb2.netobjects.com/register/reg.cfm', '', args, false, true, true);
  100.  
  101.         if (s.search('status=success') != -1)
  102.         {
  103.             app.SetSystemVar('nof_up_id', email);
  104.             app.SetSystemVar('nof_up_updated', false);
  105.             app.SetSystemVar('nof_up_registered', true);
  106.         }
  107.     }
  108. }
  109.  
  110.  
  111.